﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;
using System.Text;
using System.Linq;

namespace RenRenClient
{
    public class APIParameterCollection : List<APIParameter>
    {
        public string Join(string separator)
        {
            var paralist = this.Select(p => p.ToString()).OrderBy(s => s);
            return string.Join(separator, paralist);
        }

        public void Add(string name, string value)
        {
            var para = new APIParameter(name, value);
            this.Add(para);
        }
    }

    public class APIParameter
    {
        public string Name { get; set; }
        public string Value { get; set; }

        public APIParameter(string name, string value)
        {
            Name = name;
            Value = value;
        }

        public override string ToString()
        {
            return string.Format("{0}={1}", Name, Value);
        }
    }
}
